﻿
@model IEnumerable<Vms.Web.Models.LIB_CONTENT>

@section scripts
{
    
}

<table>
@foreach (var item in Model)
{

    List<Vms.Web.Models.LIB_CONTENT_IMG> _libContentImgs = item.LIB_CONTENT_IMG.ToList();
    Vms.Web.Models.LIB_CONTENT_IMG _libContentImg = _libContentImgs.First();

    List<Vms.Web.Models.LIB_CONTENT_TXT> _libContentTxts = item.LIB_CONTENT_TXT.ToList();
    Vms.Web.Models.LIB_CONTENT_TXT _libContentTxt = _libContentTxts.First();
    
    <tr>
        @{
            var libContent_ID = "libContent_Id";

            var libContentImg_ImgX = "libContentImg_ImgX" + item.Id;
            var libContentImg_ImgY = "libContentImg_ImgY" + item.Id;
            var libContentImg_ImgWidth = "libContentImg_ImgWidth" + item.Id;
            var libContentImg_ImgHeight = "libContentImg_ImgHeight" + item.Id;
            var libContentImg_ImgMethod = "libContentImg_ImgMethod" + item.Id;
            var libContentImg_ImgRunSpeed = "libContentImg_ImgRunSpeed" + item.Id;
            var libContentImg_ImgImages = "libContentImg_ImgImages" + item.Id;

            var libContentTxt_Txt = "libContentTxt_Txt" + item.Id;
            var libContentTxt_TxtX = "libContentTxt_TxtX" + item.Id;
            var libContentTxt_TxtY = "libContentTxt_TxtY" + item.Id;
            var libContentTxt_TxtWidth = "libContentTxt_TxtWidth" + item.Id;
            var libContentTxt_TxtHeight = "libContentTxt_TxtHeight" + item.Id;
            var libContentTxt_TxtMethod = "libContentTxt_TxtMethod" + item.Id;
            var libContentTxt_TxtRunSpeed = "libContentTxt_TxtRunSpeed" + item.Id;
            var libContentTxt_TxtFontName = "libContentTxt_TxtFontName" + item.Id;
            var libContentTxt_TxtFontSize = "libContentTxt_TxtFontSize" + item.Id;
            var libContentTxt_TxtBold = "libContentTxt_TxtBold" + item.Id;
            var libContentTxt_TxtFontColor = "libContentTxt_TxtFontColor" + item.Id;

            // Tung : convert font-color for setup screen template select bar
                var txtFontColor = "Red";
                // { { "Black", 0 }, { "Red", 1 }, {"Green", 2}, {"Yellow", 3} };
                if (_libContentTxt.FontColor==0)
                {
                    txtFontColor = "Black";
                }
                else if (_libContentTxt.FontColor==3)
                {
                    txtFontColor = "Yellow";
                }
                else if (_libContentTxt.FontColor==2)
                {
                    txtFontColor = "Green";
                }
            // Tung : convert font-weight for setup screen template select bar
            
                var txtFontWeight = "bold";
                if (_libContentTxt.Bold==0)
                {
                    txtFontWeight = "normal";
                }
                
        }
        
        @Html.Hidden(libContent_ID, item.Id)

        @Html.Hidden(libContentImg_ImgX, _libContentImg.Img_x)
        @Html.Hidden(libContentImg_ImgY, _libContentImg.Img_y)
        @Html.Hidden(libContentImg_ImgWidth, _libContentImg.Img_Width)
        @Html.Hidden(libContentImg_ImgHeight, _libContentImg.Img_Height)
        @Html.Hidden(libContentImg_ImgMethod, _libContentImg.DisplayMode)
        @Html.Hidden(libContentImg_ImgRunSpeed,_libContentImg.RunSpeed)
        @Html.Hidden(libContentImg_ImgImages,_libContentImg.ImgFileName)

        @Html.Hidden(libContentTxt_Txt, _libContentTxt.Txt)
        @Html.Hidden(libContentTxt_TxtX,_libContentTxt.Txt_x)
        @Html.Hidden(libContentTxt_TxtY, _libContentTxt.Txt_y)
        @Html.Hidden(libContentTxt_TxtWidth, _libContentTxt.Txt_Width)
        @Html.Hidden(libContentTxt_TxtHeight, _libContentTxt.Txt_Height)
        @Html.Hidden(libContentTxt_TxtMethod, _libContentTxt.DisplayMode)
        @Html.Hidden(libContentTxt_TxtRunSpeed, _libContentTxt.RunSpeed)
        @Html.Hidden(libContentTxt_TxtFontName,_libContentTxt.FontName)
        @Html.Hidden(libContentTxt_TxtFontSize, _libContentTxt.FontSize)
        @Html.Hidden(libContentTxt_TxtBold,_libContentTxt.Bold)
        @Html.Hidden(libContentTxt_TxtFontColor,_libContentTxt.FontColor)
        <td>            
            <div id="lib_screenContainer" 
                style="position: relative;
                       background-color: #333333;
                       height: 150px;
                       margin-left: 40px;
                       margin-top: 20px;
                       margin-bottom: 20px;
                       width: 700px;">        
                <!-- demo drag imgs Tung: 28/3/2013 -->
                <div id="lib_dragThisImg"
                     style="position: relative;
                            width:  @{@_libContentImg.Img_Width}px;
                            height: @{@_libContentImg.Img_Height}px;
                            left: @{@_libContentImg.Img_x}px; 
                            top: @{@_libContentImg.Img_y}px;
                            border: 1px solid #ccc;       
                            background: url('/Areas/Lib/Lib_Data/Imgs/@_libContentImg.ImgFileName') no-repeat;">
               
                </div>
                <div id="lib_dragThisText"
                     style="position: relative;
                            width: @{@_libContentTxt.Txt_Width}px; 
                            height: @{@_libContentTxt.Txt_Height}px;
                            left: @{@_libContentTxt.Txt_x}px;  
                            top: @{@_libContentTxt.Txt_y}px;
                            border: 1px solid #ccc;">
                    <label id="lib_content_txt"
                         style="
                                font-family: @{@_libContentTxt.FontName};
                                font-weight: @{@txtFontWeight};
                                font-size: @{@_libContentTxt.FontSize}px;  
                                line-height: 30px;   
                                color: @{@txtFontColor}; ">@_libContentTxt.Txt</label>
                </div>
            </div>
        </td>
        <td>
            <span class="btn btn-primary spanDialogSelectTemplate">Select</span>
        </td>
        
    </tr>
    
}

</table>
